

let sockeMap = {}

/**
 * 添加socket对象
 * @param {object} socket
 */
sockeMap.addSocket = function (socket){
    sockeMap[socket.id] = socket
}

/**
 * 删除socket对象
 * @param {string} socketId
 */
sockeMap.delSocket = function (socketId){
    delete sockeMap[socketId]
}

/**
 * 发送数据
 * @param {string} socketId
 * @param {string} key
 * @param {object} data
 */
sockeMap.emit = function (socketId, key, data){
    if(sockeMap[socketId]){
        sockeMap[socketId].emit(key, data)
    }
}



module.exports = sockeMap